/***************************************************************************
 创建者: 华磊
 开始时间: 2018.8.14
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2017.5.8 类的具体实现代码编写

 ***************************************************************************
 *  @file powermanager.h
 *  功能:权限管理，系统对外总接口类
 *
 *                                                                         *
 ***************************************************************************/
#ifndef POWERMANAGER_H
#define POWERMANAGER_H

#include "MacroDefine/GeneralDefine.h"
#include "vehicle/vehicledefine.h"
#include "MacroDefine/fleetdefine.h"
#include <string>
#include <QString>
#include <vector>
#include <QMap>
#include "globalDefine.h"
#include <gSoapFoundation/soapStub.h>
#include <queue>

class RobotManager;
class MessageLog;
class GlobalManager;
class CommRobotiq;
class MeasureTime;
class SafeWatchDog;
class AuthorityAllowance;
class SafetyFunction;
class McControllerInterpreter;
class ProgramEngine;
//class FleetService;


/**
 * @brief The PowerManager class ，权限管理，系统对外总接口类.gsoap webserver mainWindow都会调用
 */
class PowerManager
{

public:
    explicit PowerManager();
    ~PowerManager();

public:
    int getLaserCameraBufferMoveConfigParameter(struct UserInfo userInfo,struct BufferMoveConfig &paraOut);
    int setLaserCameraBufferMoveConfigParameter(struct UserInfo userInfo,struct BufferMoveConfig paraIn,int &returnFlag);
    int getLaserTrackConfigParameter(struct UserInfo userInfo,struct LaserTrackConfig &paraOut);
    int setLaserTrackConfigParameter(struct UserInfo userInfo,struct LaserTrackConfig paraIn,int &returnFlag);
    int addCircle(struct UserInfo userInfo,int idIn, std::vector<double> posIn, std::vector<double> centerIn,
                  std::vector<double> normalIn, double vel, int turnsIn, int velTypeIn,int &returnFlag);
    int addProgramMoveCommand_hmi(struct UserInfo userInfo,vector<MoveParameter> tmpCommandVectorIn,int &returnFlag);
    int getPalletConditionInfo(struct UserInfo userInfo,std::vector<struct PalletMiddleInfo> &infoOut);
    int setPalletConditionInfo(struct UserInfo userInfo,struct StackInfo infoIn,int &returnFlag);
    int getWeaveMotionConditionInfo(struct UserInfo userInfo,std::vector<struct WeaveMotionCondition> &infoOut);
    int setWeaveMotionConditionInfo(struct UserInfo userInfo, struct WeaveMotionCondition infoIn, int &returnFlag);
    int getWeldDebugStatusInfo(struct UserInfo userInfo,struct WeldCraftStatusInfo& infoOut);
    int weldDebugOperation(struct UserInfo userInfo,enum E_WELD_TEST typeIn,bool control,int &returnFlag);
    int setWeldCollisionCheck(struct UserInfo userInfo,bool isCheck,int &returnFlag);
    int getTrigPosition(QQueue<PointPro> &trigPoseOut);
    int stopMotionTrig(int doIndex);//结束触发
    int setMotionTrigPara(int doIndex,double trigPeriod);//开始触发
    int setGravityVector(struct UserInfo userInfo,std::vector<double> gravityIn,int &returnFlag);
    int setToolMass(struct UserInfo userInfo,int toolIndex, double mass,
                    std::vector<double> center,int &returnFlag);
    int setDragControl(struct UserInfo userInfo,bool isOn,int &returnFlag);
    int getRobotCoordinateConfig(struct UserInfo userInfo,struct RobotCoordinateAxisConfig &configOut);
    int setRobotCoordinateConfig(struct UserInfo userInfo,struct RobotCoordinateAxisConfig configIn,int &returnFlag);

    int getBatteryPeakConfig(struct UserInfo userInfo,struct BatteryPeakConfig &configOut);
    int setBatteryPeakConfig(struct UserInfo userInfo,struct BatteryPeakConfig configIn,int &returnFlag);

    int getReflectLaserFilterParameter(struct UserInfo userInfo,int index,struct LaserFilterParameter &paraOut);
    int setReflectLaserFilterParameter(struct UserInfo userInfo,int index,struct LaserFilterParameter  paraIn,
                                       int &returnFlag);
    int getReflectCalculateCommonParameter(struct UserInfo userInfo,struct ReflectCommonDetectPara &paraOut);
    int setReflectCalculateCommonParameter(struct UserInfo userInfo,struct ReflectCommonDetectPara paraIn,
                                           int &returnFlag);
    int getAmclDebugInfo(struct UserInfo userInfo,struct AmclDebugInfo &debugInfoOut);


    int getVehicleMovingCaligrateInfo(struct UserInfo userInfo,struct VehicleMovingCaligrateInfo &infoOut);
    int setCalibrateWheelDiameter(struct UserInfo userInfo,double idealMovedLength,double actualMovedLength,int &returnFlag);
    int setCalibrateWheelDistance(struct UserInfo userInfo,double idealMovedAngle,double actualMovedAngle,int &returnFlag);
    int setEthernetIpAddress(struct UserInfo userInfo,string netNameIn,string ipIn,int &returnFlag);
    int setAmclPara(struct UserInfo userInfo,struct AmclDebugPara paraIn,int &returnFlag);
    int getAmclPara(struct UserInfo userInfo,struct AmclDebugPara &paraOut);
    int setCurrentVehicleBorderId(struct UserInfo userInfo,int idIn,int &returnFlag);
    int getCurrentVehicleBorderId(struct UserInfo userInfo,int &idOut);
    int setSefetyCheck(struct UserInfo userInfo,enum E_SAFETY_CHECK typeIn,int isEnable,int &returnFlag);
    int getSefetyCheck(struct UserInfo userInfo,enum E_SAFETY_CHECK typeIn,int &checkStatusReturn);
    int getRollerMechanismStatus(struct UserInfo userInfo,enum E_ROLLER_STATUS &statusOut);
    int setRollerMechanismConfig(struct UserInfo userInfo,struct RollerMechanismConfig configIn,int &returnFlag);
    int getRollerMechanismConfig(struct UserInfo userInfo,struct RollerMechanismConfig &configOut);
    int  getLiftMechanismStatus(struct UserInfo userInfo,enum E_LIFT_STATUS &statusOut);
    int setLiftMechanismConfig(struct UserInfo userInfo,struct LiftMechanismConfig configIn,int &returnFlag);
    int getLiftMechanismConfig(struct UserInfo userInfo,struct LiftMechanismConfig &configOut);

    int getEncoderValue_belt(struct UserInfo userInfo,int beltIndexIn,int &encoderValueOut);
    int getEncoderValue_vision(struct UserInfo userInfo, int visionIndexIn, int &encoderValueOut);
    int forceConnectCamera(struct UserInfo userInfo,int visionIndex,int &returnFlag);
    int forceTrigCamera(struct UserInfo userInfo,int visionIndexIn,int isHighIn,int &returnFlag);
    int getCoupleControlInfo(struct UserInfo userInfo, std::vector<struct CoupleConfigParameter> &infoOut);
    int getAxisProperty(struct UserInfo userInfo,int axisId, struct AxisProperty_hmi &axisPropertyOut);
    int setAxisProperty(struct UserInfo userInfo,int axisId, struct AxisProperty_hmi axisPropertyIn,int &returnFlag);
    int setCoupleRelativeDistanceMonitorEnable(struct UserInfo userInfo,int followAxisId,bool isEnableIn,int &returnFlag);
    int setCoupleControlEnable(struct UserInfo userInfo,int followAxisId,bool isEnableIn,int &returnFlag);
    int getImageStringFormImagePath(struct UserInfo userInfo,std::string imagePathIn,std::string &imageStrOut);
    int setWeldVirtualMode(struct UserInfo userInfo,bool isVirtualControlIn,int &returnFlag);
    int getWeldIsVirtualStatus(struct UserInfo userInfo,int &returnFlag);

    int getAgvBorderInfo(struct UserInfo userInfo,struct VehicleBorderInfo &infoOut);
    int setAgvBorderRectInfo(struct UserInfo userInfo,struct BorderRectInfo rectInfoIn,int &returnFlag);

    int getVehicleKinematicDimension(struct UserInfo userInfo,struct VehicleKinematicDimension &infoOut);
    int setVehicleKinematicDimension(struct UserInfo userInfo,struct VehicleKinematicDimension infoIn,
                                     int &returnFlag);

    int getLaserScanParameter(struct UserInfo userInfo,int laserId,struct LaserScanParameterHmi &infoOut);
    int setLaserScanParameter(struct UserInfo userInfo,int laserId,struct LaserScanParameterHmi infoIn,
                              int &returnFlag);

    int getVehicleJogControlParameter(struct UserInfo userInfo,struct VehicleJogControlParameter &infoOut);
    int setVehicleJogControlParameter(struct UserInfo userInfo,struct VehicleJogControlParameter infoIn,
                                      int &returnFlag);

    int getVehicleTrajectoryControlParameter(struct UserInfo userInfo,
                                             struct VehicleTrajectoryControlParameter &infoOut);
    int setVehicleTrajectoryControlParameter(struct UserInfo userInfo,
                                             struct VehicleTrajectoryControlParameter infoIn,int &returnFlag);

    int getAgvSheftInfo(struct UserInfo userInfo, int sheftIndex, struct BorderRectInfo &infoOut);
    int setAgvSheftRectInfo(struct UserInfo userInfo,int sheftIndex,struct BorderRectInfo rectInfoIn,int &returnFlag);

    int getVehiclePositionCalibrateInfo(struct UserInfo userInfo,struct VehiclePosition &infoOut);

    int getLaserCameraConfigParameter(struct UserInfo userInfo, struct LaserCameraConfigParameter &infoOut);
    int getLaserCameraStatus(struct UserInfo userInfo, struct LaserCameraStatusInfo &infoOut);
    int setLaserCameraConfigParameter(struct UserInfo userInfo, struct LaserCameraConfigParameter parameter,
                                      int &returnFlag);
    int reconnectLaserCamera(struct UserInfo userInfo, int &returnFlag);
    int setLaserCameraWork(struct UserInfo userInfo,bool isWork, int &returnFlag);
    int setLaserCameraJobId(struct UserInfo userInfo,int jobIdIn, int &returnFlag);

    int calculateLaserCameraFrame(struct UserInfo userInfo,std::vector<struct PointPro> tcpPointList,
                                  std::vector<struct PointPro> cameraPointList,struct LaserCameraCalibrateResult &resultOut);
    int getLaserCameraFrameInfo(struct UserInfo userInfo,struct LaserCameraFrameInfo &infoOut);


    int returnRValue(int robotIdIn, bool &initialStatus, QVector<double> &regOut);
    int setRegisterValue(UserInfo userInfo, int typeIn, int index, int subIndex, double valueIn);
    int setRegisterValue_inner(int robotIdIn, int typeIn, int index, int subIndex, double valueIn);
    int setVisionTrigObjectLength(UserInfo userInfo,int visionIndex,double lengthIn);
    int getEncoderReciverDataList(struct UserInfo userInfo,std::vector<struct EncoderReceiverData> &dataListReturn);
    int getBeltTrackDebugInfo(struct UserInfo userInfo,int index,struct BeltTrackDebugInfo &infoOut);
    int getVisionTrackDebugInfo(struct UserInfo userInfo,int index,struct VisionTrackDebugInfo &infoOut);

    int getWeldConditionConfigList(struct UserInfo userInfo,std::vector<struct WeldCondition> &configListOut);
    int getWeldPropertyConfigList(struct UserInfo userInfo,std::vector<struct WeldProperty> &configListOut);
    int getVisionTrackConfigList(struct UserInfo userInfo,std::vector<struct VisionTrackConfig> &configListOut);
    int getBeltTrackConfigList(struct UserInfo userInfo,std::vector<struct BeltTrackConfig> &configListOut);
    int changeVisionTrackConfig(struct UserInfo userInfo,int id,struct VisionTrackConfig configIn,int &returnFlag);
    int changeBeltTrackConfig(struct UserInfo userInfo,int id,struct BeltTrackConfig configIn,int &returnFlag);
    int changeWeldPropertyConfigList(struct UserInfo userInfo,struct WeldProperty configIn);
    int changeWeldConditionConfigList(struct UserInfo userInfo,struct WeldCondition configIn);
    int getWeldSystemInfo(struct UserInfo userInfo, struct WeldSystemInfo &weldSystemInfo);
    int changeWeldSystemInfo(struct UserInfo userInfo, struct WeldSystemInfo configIn);

    int getMapPropertyInfo(struct UserInfo userInfo,std::string mapName,struct MapPropertyInfo &infoOut);
    int getFleetMap(struct UserInfo userInfo,std::string mapName,std::string &mapInfoReturn);//返回路径地图文本
    int writeFleetMap(struct UserInfo userInfo, std::string mapName, string &mapInfoIn);
    int calculateZeroOffset(struct UserInfo userInfo,std::vector<PointPro> pointList, AxisZeroOffsetInfo &returnInfo);
    int calibrateRobotByOffset(struct UserInfo userInfo,std::vector<double> offsetIn,int &returnFlag);
    int getPathMovingInfo_virtualLineControl(PathMovingInfo &infoOut);
    int errorNoticeForFleetService();
    int getAllReferenceMarks(struct UserInfo userInfo,std::vector<struct ReflectMarkInfo> &reflectMarksOut);
    int addReferenceMarkToMap(struct UserInfo userInfo,struct ReflectMarkInfo markIn,int &returnFlag);
    int saveReferenceMarkToFile(struct UserInfo userInfo,std::string fileNameIn,int &returnFlag);
    int deleteReferenceMarkInMap(struct UserInfo userInfo,int uniqId,int &returnFlag);
    int getReflectDebugInfo(struct UserInfo userInfo,struct ReflectDebugInfo &matchDebugInfoOut);
    int setOriginalLaserFilterType(struct UserInfo userInfo,int typeIn,int &returnFlag);

    int getCurrentPathInformation(struct UserInfo userInfo, VehiclePosition &startPositionOut, QVector<VehiclePosition> &targetPositionOut, int &pointIndexOut, E_NAV_COMMAND &currentPathTypeOut,
                           double &currentPathParameter1Out, double &currentPathParameter2Out);
    //toDo接口需要用Mutex保护起来，因为QMap不允许同时调用。
    int changeComputerTime(struct UserInfo userInfo,std::string timeIn, int &returnFlag);
    int getSocketFleetCommandLog(std::queue<string> &fleetCommandLogOut);
    int getModbusFleetCommandLog(std::queue<string> &fleetCommandLogOut);
    int getEngineStatue();
    int setEngineStatus_fleet(STOP_COMMAND_TYPE statusIn);
    int setRunningNumber_virtualLineControl(float numberIn);
    int addMonitorDi_fleet(struct UserInfo userInfo,bool isOr,QVector<int> diIndex,QVector<int> diValue);
    int executeMoveRobotArm_run(struct UserInfo userInfo,const QVector<int> &lineList,
                                   const QVector<RobotArmMoveParameter> &pathListParaIn, int isLastPointMove=0);
    int executeMultiPoint_run(struct UserInfo userInfo,const QVector<int> &lineList,
                                   const QVector<LaserPathParameter> &laserPathListParaIn, int isLastPointMove=0);
    int executeMoveMaganeticInstruction(struct UserInfo userInfo,const MaganeticPathParameter paraIn);
    int executeChargeInstruction(struct UserInfo userInfo, const ChargeParameter &chargeParaIn);
    int executeLiftInstruction(struct UserInfo userInfo,const LiftParameter &liftParaIn);
    int executeRollerInstruction(struct UserInfo userInfo,const RollerParameter &rollerParaIn);
    int loadMapAndSetOdometer(struct UserInfo userInfo,QString mapName,VehiclePosition position);
    int setUltrasonicSensorDebugFlag(int debugFlagIn);
    int setGlobalManagerDebugFlag(int debugFlagIn);
    int getQrcodeDebugInfo(struct UserInfo userInfo,struct QrcodeDebugInfo &infoOut);
    int getBarriorDetectMode(E_BARRIER_TETECT_MODE &modeOut);
    int getBarrierRunMode(E_BARRIER_RUN_MODE &modeOut);
    int playBarriorMusic(double barrierRatioIn);
    int playMusic(QString musicFileName,int musicPlayTimes,int musicVolume);
    int playSystemMusic(QString nameIn, int musicPlayTimes);
    int playErrorMusic();
    int restoreNormalMusic();
    int getSafeCollisionInfo(struct UserInfo userInfo,int sensorType, struct CollisionPara &infoOut);
    /**
     * @brief setSafeCollisionInfo 设置躲避障碍参数，需要程序重启生效。
     * @param userInfo
     * @param sensorType
     * @param infoIn
     * @param returnFlag
     * @return
     */
    int setSafeCollisionInfo(struct UserInfo userInfo, int sensorType, struct CollisionPara infoIn,
                             int &returnFlag);

    int getSerialPortListInfo(struct UserInfo userInfo, QStringList &ListOut);
    /**
     * @brief setUltrasonicSensor485Address 没有判断是否写入成功
     * @param userInfo
     * @param origineAddressIn
     * @param addressIn
     * @param returnFlag
     * @return
     */
    int setUltrasonicSensor485Address(struct UserInfo userInfo,int origineAddressIn, int addressIn, int &returnFlag);

    /**
     * @brief getRobotLogFileInfo           获取控制器端robotLog.xml日志内容
     * @param userInfo                      用户信息
     * @param messagesLogOut                保存日志文件信息
     * @return                              返回值: 0:success -1:failed
     */
    int getRobotLogFileInfo(struct UserInfo userInfo, std::vector < struct Message > &messagesLogOut);

    /**
     * @brief addCommand 插入用户命令
     * @param commandIn
     * @return
     */
    int addCommand(UserCommandData commandIn, int &returnFlag);

    /**
     * @brief removeRobotProgramFile            删除程序文件
     * @param userInfo                          用户信息
     * @param fileName                          要删除的程序文件名
     * @param returnFlag                        返回标识
     * @return                                  success:0  failed:-1
     */
    int removeRobotProgramFile(struct UserInfo userInfo, std::string fileName, int &returnFlag);

    /**
     * @brief readRobotProgramFile
     * @param userInfo
     * @param fileName
     * @param fileStringOut
     * @return 
     */
    int readRobotProgramFile(struct UserInfo userInfo, std::string fileName, std::vector<string> &fileStringOut);
    int writeRobotProgramFile(struct UserInfo userInfo,std::string fileName, std::vector <std::string> fileStringIn,int &returnFlag);
    int get_robot_program_files_strings(struct UserInfo userInfo,int languageId,struct RunningProgramInfo &infoOut);
    int get_running_program_file_strings(struct UserInfo userInfo,int languageId,std::string fileName,
                                         std::vector<std::string> &infoOut);
    int set_di_name_info(struct UserInfo userInfo,int indexIn,std::string nameIn,int &returnFlag);
    int set_do_name_info(struct UserInfo userInfo,int indexIn,std::string nameIn,int &returnFlag);
    int set_ai_name_info(struct UserInfo userInfo,int indexIn,std::string nameIn,int &returnFlag);
    int set_ao_name_info(struct UserInfo userInfo,int indexIn,std::string nameIn,int &returnFlag);
    int set_si_name_info(struct UserInfo userInfo,int indexIn,std::string nameIn,int &returnFlag);
    int set_so_name_info(struct UserInfo userInfo,int indexIn,std::string nameIn,int &returnFlag);

    /**
     * @brief get_di_names_info         获取DI所有注释名
     * @param userInfo                  用户信息
     * @param namesOut                  注释名列表
     * @param returnFlag                执行返回状态  success:0  failed:-1
     * @return                          执行返回状态  success:0  failed:-1
     */
    int get_di_names_info(struct UserInfo userInfo, std::vector <std::string> &namesOut);

    /**
     * @brief get_do_names_info         获取DO所有注释名
     * @param userInfo                  用户信息
     * @param namesOut                  注释名列表
     * @param returnFlag                执行返回状态  success:0  failed:-1
     * @return                          success:0  failed:-1
     */
    int get_do_names_info(struct UserInfo userInfo, std::vector <std::string> &namesOut);
    int get_ai_names_info(struct UserInfo userInfo, std::vector <std::string> &namesOut);
    int get_ao_names_info(struct UserInfo userInfo, std::vector <std::string> &namesOut);
    int get_si_names_info(struct UserInfo userInfo, std::vector <std::string> &namesOut);
    int get_so_names_info(struct UserInfo userInfo, std::vector <std::string> &namesOut);

    int get_All_IO_NamesInfo(struct UserInfo userInfo, struct IOMapNamesInfo &nameOut);

    /**
     * @brief setDefaultMapName 设置默认地图
     * @param userInfo
     * @param fileNameIn
     * @param returnFlag
     * @return
     */
    int setDefaultMapName(struct UserInfo userInfo,std::string fileNameIn, int &returnFlag);
    int setBarrierRunMode(struct UserInfo userInfo,E_BARRIER_RUN_MODE modeIn, int &returnFlag);
    /**
     * @brief setCheckVehiclePosition_amcl 设置定位方法是否检查失败
     * @param userInfo
     * @param isCheck
     * @param returnFlag
     * @return
     */
    int setCheckVehiclePosition_amcl(struct UserInfo userInfo,bool isCheck,int &returnFlag);
    /**
     * @brief moveToNavgationPoint 导航运动到点
     * @param userInfo
     * @param parameterIn
     * @param returnFlag
     * @return
     */
    int moveToNavgationPoint(struct UserInfo userInfo,MovingToNavagationParameter parameterIn,int &returnFlag);
    /**
     * @brief setLaserIntensityFilterByType_visionMatch 设置激光滤波类型
     * @param userInfo
     * @param typeIn
     * @param returnFlag
     * @return
     */
    int setLaserIntensityFilterByType_visionMatch(struct UserInfo userInfo,int typeIn,int &returnFlag);
    /**
     * @brief getLicenseDayLefted 获取许可证有效天数
     * @return
     */
    int getLicenseDayLefted();
    /**
     * @brief checkRegisterStatus　检查注册状态
     * @return
     */
    int checkRegisterStatus();
    /**
     * @brief getVehicleSafeSpeedRatio 获取车当前安全速率
     * @param userInfo
     * @param ratioOut
     * @return
     */
    int getVehicleSafeSpeedRatio(struct UserInfo userInfo,double &ratioOut);
    int getBarrierProtectRatioOfMoving(struct UserInfo userInfo,double &ratioOut);
    /**
     * @brief getMatchDebugInfo_vmark 获取Ｖ槽信息
     * @param userInfo
     * @param infoOut
     * @return
     */
    int getMatchDebugInfo_vmark(struct UserInfo userInfo,VisionMatchDebugInfo &infoOut);
    /**
     * @brief setLaserFilterByType_vmark 设置激光滤波类型
     * @param userInfo
     * @param typeIn
     * @param returnFlag
     * @return
     */
    int setLaserFilterByType_vmark(struct UserInfo userInfo,int typeIn,int &returnFlag);//与重复setLaserIntensityFilterByType_visionMatch
    /**
     * @brief setCurrentVMarkIndex 设置当前Ｖmark序号
     * @param userInfo
     * @param indexIn
     * @param returnFlag
     * @return
     */
    int setCurrentVMarkIndex(struct UserInfo userInfo,int indexIn,int &returnFlag);
    /**
     * @brief setCurrentVMarkType 设置当前Ｖmark类型
     * @param userInfo
     * @param currentVmarkTypeIn
     * @param returnFlag
     * @return
     */
    int setCurrentVMarkType(struct UserInfo userInfo,int currentVmarkTypeIn,int &returnFlag);
    /**
     * @brief getVmarkInfoList 获取ｖmark信息列表
     * @param userInfo
     * @param vmarkInfoOut
     * @return
     */
    int getVmarkInfoList(struct UserInfo userInfo, std::vector<VMarkInfo> &vmarkInfoOut);
    /**
     * @brief updateVMarkFile 更新ｖmark文件
     * @param userInfo
     * @param vmarkFileIn
     * @param returnFlag
     * @return
     */
    int updateVMarkFile(struct UserInfo userInfo,std::string vmarkFileIn,int &returnFlag);
    /**
     * @brief createVMark 创建vmark
     * @param userInfo
     * @param infoIn
     * @param vmarkFileIn
     * @param returnFlag
     * @return
     */
    int createVMark(struct UserInfo userInfo, VMarkInfo infoIn, string vmarkFileIn, int &returnFlag);
    /**
     * @brief getVMarkPositionInWorld 获取ｖmark的世界坐标
     * @param userInfo
     * @param positionReturn
     * @return
     */
    int getVMarkPositionInWorld(struct UserInfo userInfo, PositionInfo_hmi &positionReturn);
    /**
     * @brief getTargetCommandVehiclePosition 获取车的目标点
     * @param userInfo
     * @param targetOut
     * @return
     */
    int getTargetCommandVehiclePosition(struct UserInfo userInfo,VehiclePosition &targetOut);
    int getTargetCommandVehiclePosition(VehiclePosition &targetOut, int &pointIndexOut);
    /**
     * @brief getCarBorder 获取车边框信息
     * @param userInfo
     * @param carBorderOut
     * @return
     */
    int getCarBorder(struct UserInfo userInfo,std::vector<VehiclePosition> &carBorderOut);
    /**
     * @brief getCarBorderOffset 获取车边框偏移信息
     * @param userInfo
     * @param carBorderOffsetOut
     * @return
     */
    int getCarBorderOffset(struct UserInfo userInfo, std::vector<VehiclePosition> &carBorderOffsetOut);
//    /**
//     * @brief get_di_name_info 获取ｄi名字信息
//     * @param userInfo
//     * @param namesOut
//     * @return
//     */
//    int get_di_name_info(struct UserInfo userInfo,std::vector<std::string> &namesOut,int &returnFlag);
//    /**
//     * @brief get_do_name_info 获取do名字信息
//     * @param userInfo
//     * @param namesOut
//     * @return
//     */
//    int get_do_name_info(struct UserInfo userInfo,std::vector<std::string> &namesOut,int &returnFlag);
    /**
     * @brief getDpoint 获取dp点信息
     * @param userInfo
     * @param fileName
     * @param pointIndex
     * @param pointOut
     * @return
     */
    int getDpoint(struct UserInfo userInfo,std::string fileName,int pointIndex,DPoint &pointOut);
    /**
     * @brief recordDpoint 记录ｄｐ点
     * @param userInfo
     * @param fileName
     * @param pointIn
     * @return
     */
    int recordDpoint(struct UserInfo userInfo,std::string fileName,DPoint pointIn);
    /**
     * @brief get_robot_running_program_files_info 获取机器运行的程序状态信息
     * @param userInfo
     * @param fileNames
     * @param runningLines
     * @return
     */
    int get_robot_running_program_files_info(struct UserInfo userInfo,std::vector<std::string> &fileNames,
                                             std::vector<int> &runningLines);
    /**
     * @brief get_robot_program_files_strings 获取机器运行的程序文件信息
     * @param userInfo
     * @param fileNames
     * @param runningLines
     * @param programStrings
     * @return
     */
    int get_robot_program_files_strings(struct UserInfo userInfo,int languageId,std::vector<std::string> &fileNames,
                                        std::vector<int> &runningLines,
                                        QVector<QVector<QString> > &programStrings);
    /**
     * @brief getRobotProgramFileList 获取机器人程序列表
     * @param userInfo
     * @param programFileListOut
     * @return
     */
    int getRobotProgramFileList(struct UserInfo userInfo,std::vector<std::string> &programFileListOut);

    /**
     * @brief getAllPointCloud_translated 获取激光点云
     * @param userInfo
     * @param pointCloudOut
     * @return
     */
    int getAllPointCloud_translated(struct UserInfo userInfo,std::vector<PointCloudData_3D> &pointCloudOut);
    /**
     * @brief calibrateVehicle 校准车体
     * @param userInfo
     * @param xOffset
     * @param yOffset
     * @param rOffset
     * @param returnFlag
     * @return
     */
    int calibrateVehicle(struct UserInfo userInfo,double xOffset,double yOffset,double rOffset,int &returnFlag);




    /**
     * @brief setDefaultProgramFile 设置默认程序文件
     * @param inProgramName
     * @return
     */
    int setDefaultProgramFile(UserInfo userInfo,std::string inProgramName,int &returnFlag);
    /**
     * @brief getMapNameList 获取控制器更新信息
     * @param userInfo
     * @param mapNameListOut　返回列表
     * @return
     */
     int getUpdateControllerInfoLevel1(UserInfo userInfo, UpdateDataLv1 &updateDataLv1);

    /**
     * @brief getMapNameList 获取地图文件列表
     * @param userInfo
     * @param mapNameListOut　返回列表
     * @return
     */
    int getMapNameList(struct UserInfo userInfo,std::vector<std::string> &mapNameListOut);
    /**
     * @brief getVehicleSpeedFeedback 返回车速
     * @param userInfo
     * @param velocityOut　返回车速
     * @return
     */
    int getVehicleSpeedFeedback(struct UserInfo userInfo,VehicleVelocity &velocityOut);
    /**
     * @brief resetCustomOdometer_positionManage 重置用户里程表
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int resetCustomOdometer_positionManage(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief getOdometer_positionManage 获取里程表信息
     * @param userInfo
     * @param historyOdomOut
     * @param historyTimeOut
     * @param customOdomOut
     * @param customeTimeOut
     * @return
     */
    int getOdometer_positionManage(struct UserInfo userInfo,double &historyOdomOut, double &historyTimeOut,
                    double &customOdomOut, double &customeTimeOut);
    /**
     * @brief forceQuitProgram 强制退出程序
     * @return
     */
    int forceQuitProgram();
    /**
     * @brief getBatteryInfo 获取电池信息
     * @param batteryInfoOut
     * @return
     */
    int getBatteryInfo(BatteryInformation &batteryInfoOut);
    /**
     * @brief getPointCloudSafeStatus 获取点云安全状态
     * @param sensorNameOut
     * @param sensorSafeRatioOut
     * @param isCheckEnableOut
     * @return
     */
    int getPointCloudSafeStatus(std::vector<std::string > &sensorNameOut,std::vector<double> &sensorSafeRatioOut,
                                bool &isCheckEnableOut);
    /**
     * @brief setPointCloudCheckEnable 设置是否检查点云壁障。
     * @param userInfo
     * @param isOn
     * @param returnFlag
     * @return
     */
    int setPointCloudCheckEnable(struct UserInfo userInfo,bool isOn,int &returnFlag);
    /**
     * @brief setPointCloudCheckEnable 设置是否检查点云。
     * @param isOn
     * @return
     */
    int setPointCloudCheckEnable(bool isOn);
    /**
     * @brief setUltrasonicSensorCheckEnable 设置是否检查超声波
     * @param isOn
     * @return
     */
    int setUltrasonicSensorCheckEnable(bool isOn);
    /**
     * @brief setUltrasonicSensorCheckEnable 设置是否检查超声波
     * @param userInfo
     * @param isOn
     * @param returnFlag
     * @return
     */
    int setUltrasonicSensorCheckEnable(struct UserInfo userInfo,bool isOn,int &returnFlag);
    /**
     * @brief getUltrasonicSensorSafeStatus 获取超声波检查状态
     * @param safeStatusOut
     * @param isCheckEnableOut
     * @return
     */
    int getUltrasonicSensorSafeStatus(std::vector<double> &safeStatusOut,bool &isCheckEnableOut);
    /**
     * @brief setUltrasonicPowerSupplyNoiseClass 设置超声波电源噪音等级
     * @param classIn　等级
     * @return
     */
    int setUltrasonicPowerSupplyNoiseClass(int classIn);
    /**
     * @brief setUltrasonicWork 设置超声波是否工作
     * @param locationIn　那个方位的超声波
     * @param isEnable　启用或停止
     * @return
     */
    int setUltrasonicWork(int locationIn,bool isEnable);
    /**
     * @brief getUltrasonicDetectDistance 获取超声波距离
     * @param distanceResultOut　返回距离
     * @return
     */
    int getUltrasonicDetectDistance(QVector<double> &distanceResultOut);
    /**
     * @brief getUltrasonicDetectDistance 获取超声波距离
     * @param distanceResultOut
     * @return
     */
    int getUltrasonicDetectDistance(std::vector<double> &distanceResultOut);
    int getUltrasonicSensorName(std::vector<std::string> &sensorNames);
    /**
     * @brief getUltrasonicDetectDistance 获取超声波距离
     * @param locationIn　那个方位的超声波
     * @param distanceResultOut　返回距离
     * @return
     */
    int getUltrasonicDetectDistance(int locationIn,QVector<double> &distanceResultOut);
    /**
     * @brief getUltrasonicStatus超声波数据收发状态
     * @param deviceRequestCountOut　返回丢失的请求个数
     * @return
     */
    int getUltrasonicStatus(QVector<int> &deviceRequestCountOut);

    /**
     * @brief resetMaster 复位ecat master
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int resetMaster(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief resetMasterTimeMeasure 复位ｅｃａｔ master 时间测量
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int resetMasterTimeMeasure(struct UserInfo userInfo,int &returnFlag);

    /**
     * @brief vehicleJog agv手动控制
     * @param userInfo
     * @param robotIdIn　默认输入１
     * @param xMove　车体ｘ方向平移（－１，１）
     * @param yMove 车体ｙ方向平移（－１，１）
     * @param rotate车体ｒ方向旋转（－１，１）
     * @return
     */
    int vehicleJog(UserInfo userInfo,int robotIdIn, double xMove, double yMove, double rotate);
    /**
     * @brief jogStop 手动控制停止。看门狗被复位了。
     * @param userInfo
     * @return
     */
    int jogStop(UserInfo userInfo);
    //***************AGV接口函数部分 ros->agvBaseControl********************************

    /**
     * @brief addMessage 添加消息（暂时没用）
     * @param userInfo
     * @param addMsgLog
     * @param returnFlag
     * @return
     */
    int addMessage(struct UserInfo userInfo,struct Message addMsgLog,int &returnFlag);
    /**
     * @brief getWheelData 获取ａgv车轮数据
     * @param userInfo
     * @param robotIdIn　默认输入１
     * @param wheelMoveSpeed　返回车轮速度
     * @param wheelPathLength
     * @return
     */
    int getWheelData(UserInfo userInfo, int robotIdIn, vector<double>& wheelMoveSpeed,
                     vector<double>& wheelPathLength);
    /**
     * @brief getOdometer 获取编码器里程表
     * @param userInfo
     * @param robotIdIn
     * @param vehicleVelFeedbackOut
     * @param vehiclePositionFeedbackOut
     * @return
     */
    int getOdometer(UserInfo userInfo, int robotIdIn, VehicleVelocity& vehicleVelFeedbackOut,
                    VehiclePosition& vehiclePositionFeedbackOut);


    /**
     * @brief vehicleAuto agv自动速度控制（暂时没用）
     * @param userInfo
     * @param robotIdIn
     * @param xMove
     * @param yMove
     * @param rotate
     * @return
     */
    int vehicleAuto(UserInfo userInfo,int robotIdIn, double xMove, double yMove, double rotate);

    //***************AGV接口函数部分 hmi->agvBaseControl->ros********************************

    /**
     * @brief getCurrentMapName 获取当前加载的地图文件名字
     * @param userInfo
     * @param mapNameReturn　当前加载的地图文件名字
     * @return
     */
    int getCurrentMapName(UserInfo userInfo,std::string &mapNameReturn);

    //地图

    /**
     * @brief setMapSolver 设置地图求解器
     * @param userInfo
     * @param solverIn　求解器序号
     * @param laserCount　使用激光个数
     * @param returnFlag
     * @return
     */
    int setMapSolver(struct UserInfo userInfo,enum E_MAP_SOLVER solverIn,
                     int laserCount,int &returnFlag);

    /**
     * @brief createMapStart 开始创建地图
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int createMapStart(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief createMapEnd 结束创建地图
     * @param userInfo
     * @param mapName　地图保持名字
     * @param returnFlag
     * @return
     */
    int createMapEnd(struct UserInfo userInfo,std::string mapName,int &returnFlag);
    /**
     * @brief loadMap 加载地图
     * @param userInfo
     * @param mapName　地图名字
     * @param returnFlag
     * @return
     */
    int loadMap(struct UserInfo userInfo,std::string mapName,int &returnFlag);
    int deleteMap(struct UserInfo userInfo,std::string mapName,int &returnFlag);

    //添加虚拟墙
    /**
     * @brief addVitrualBlock 添加地图虚拟墙
     * @param userInfo
     * @param configFilePath　虚拟墙的配置文件名
     * @param returnFlag
     * @return
     */
    int addVitrualBlock(struct UserInfo userInfo,std::string configFilePath,int &returnFlag);
    /**
     * @brief deleteVitrualBlock 删除虚拟墙
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int deleteVitrualBlock(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief addForbidenZone 添加禁行区域
     * @param userInfo
     * @param x_start
     * @param y_start
     * @param x_end
     * @param y_end
     * @param returnFlag
     * @return
     */
    int addForbidenZone(struct UserInfo userInfo,double x_start,double y_start
                        ,double x_end,double y_end,int &returnFlag);

    //定位
    /**
     * @brief setOdomSolver 设置里程计方法
     * @param userInfo
     * @param solverIn　方法id
     * @param returnFlag
     * @return
     */
    int setOdomSolver(struct UserInfo userInfo,enum E_ODOM_SOLVER solverIn,int &returnFlag);
    /**
     * @brief setLocationSolver 设置定位方法
     * @param userInfo
     * @param solverIn　方法id
     * @param returnFlag
     * @return
     */
    int setLocationSolver(struct UserInfo userInfo,enum E_LOCATION_SOLVER solverIn,int &returnFlag);
    /**
     * @brief getVehiclePosition 获取车的当前位置
     * @param userInfo
     * @param positionReturn　返回当前位置
     * @return
     */
    int getVehiclePosition(struct UserInfo userInfo,struct VehiclePosition& positionReturn);
    /**
     * @brief getVehiclePosition_specified 获取车的位置
     * @param userInfo
     * @param typeIn　定位方式
     * @param positionReturn　位置返回
     * @return
     */
    int getVehiclePosition_specified(struct UserInfo userInfo,int typeIn,PositionInfo_hmi &positionReturn);
    /**
     * @brief setVehiclePosition 初始化车体的位置
     * @param userInfo
     * @param positionIn　初始位置
     * @param returnFlag
     * @return
     */
    int setVehiclePosition(struct UserInfo userInfo,struct VehiclePosition positionIn,int &returnFlag);
    int initialVehiclePosition_byProgramPoint(struct UserInfo userInfo,  int pointIndex, int &returnFlag);

    //轨迹规划和行驶
    /**
     * @brief setReplanCoutLimitWhenFailure 设置规划失败允许重试次数
     * @param userInfo
     * @param countLimit
     * @param returnFlag
     * @return
     */
    int setReplanCoutLimitWhenFailure(struct UserInfo userInfo,int countLimit,int &returnFlag);
    /**
     * @brief setTrajectoryGlobalPlanSolver 设置全局路径求解器
     * @param userInfo
     * @param solverIn
     * @param returnFlag
     * @return
     */
    int setTrajectoryGlobalPlanSolver(struct UserInfo userInfo,enum E_TRAJECTORY_GLOBAL_SOLVER solverIn,int &returnFlag);
    /**
     * @brief setTrajectoryLocalPlanSolver 设置局部路径求解器
     * @param userInfo
     * @param solverIn
     * @param returnFlag
     * @return
     */
    int setTrajectoryLocalPlanSolver(struct UserInfo userInfo,enum E_TRAJECTORY_LOCAL_SOLVER solverIn,int &returnFlag);
    /**
     * @brief moveToPosition agv运动到目标点指令
     * @param userInfo
     * @param positionIn　目标点
     * @param velocity　速度
     * @param returnFlag
     * @return
     */
    int moveToPosition(struct UserInfo userInfo,struct VehiclePosition positionIn,
                       double velocity,int &returnFlag);
    /**
     * @brief moveFollowPath 跟踪固定轨迹
     * @param userInfo
     * @param pathIn　轨迹序列
     * @param velocity　速度
     * @param returnFlag
     * @return
     */
    int moveFollowPath(struct UserInfo userInfo,std::vector<struct VehiclePosition> pathIn,
                       double velocity,int &returnFlag);
    /**
     * @brief changeVelocity 更改ａｇｖ运动速度
     * @param userInfo
     * @param velocity
     * @param returnFlag
     * @return
     */
    int changeVelocity(struct UserInfo userInfo,double velocity,int &returnFlag);
    /**
     * @brief getMovingStatus 获取agv车的自由轨迹运动状态
     * @param userInfo
     * @param status
     * @return
     */
    int getMovingStatus(struct UserInfo userInfo,enum E_GOAL_STATUS& status);
    /**
     * @brief getRemainningTime 获取agv车的自由轨迹运动剩余时间
     * @param userInfo
     * @param timeOut
     * @return
     */
    int getRemainningTime(struct UserInfo userInfo,double &timeOut);
    /**
     * @brief getRemainningDistance 获取agv车的自由轨迹运动剩余距离
     * @param userInfo
     * @param distanceOut
     * @return
     */
    int getRemainningDistance(struct UserInfo userInfo,double &distanceOut);
    /**
     * @brief ceaseMotion agv暂停运动
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int ceaseMotion(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief startMotion agv开始运动
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int startMotion(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief cancelMotion agv取消运动
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int cancelMotion(struct UserInfo userInfo,int &returnFlag);

    //设置
    /**
     * @brief setPositionArrivedAccuracy 设置位置到达精度
     * @param userInfo
     * @param accuracyIn　精度
     * @param returnFlag
     * @return
     */
    int setPositionArrivedAccuracy(struct UserInfo userInfo,double accuracyIn,int &returnFlag);
    /**
     * @brief setLocalPlanRange 设置局部规划范围
     * @param userInfo
     * @param rangeIn　范围　，单位m
     * @param returnFlag
     * @return
     */
    int setLocalPlanRange(struct UserInfo userInfo,double rangeIn,int &returnFlag);
    /**
     * @brief setVehicleBorderOffset 设置车边框偏移
     * @param userInfo
     * @param front_offsetIn
     * @param back_offsetIn
     * @param left_offsetIn
     * @param right_offsetIn
     * @return
     */
    int setVehicleBorderOffset(struct UserInfo userInfo,double front_offsetIn,double back_offsetIn,
                               double left_offsetIn,double right_offsetIn);
    /**
     * @brief setVehicleBorderOffset 设置车体外边框
     * @param userInfo
     * @param point_x　序列点的ｘ坐标
     * @param point_y　序列点的ｙ坐标
     * @param returnFlag
     * @return
     */
    int setVehicleBorderOffset(struct UserInfo userInfo,std::vector<double> point_x, std::vector<double> point_y,int &returnFlag);
    /**
     * @brief setGlobalBarrierOffset 设置全局规划的障碍物安全距离
     * @param userInfo
     * @param offsetIn　距离
     * @param returnFlag
     * @return
     */
    int setGlobalBarrierOffset(struct UserInfo userInfo,double offsetIn,int &returnFlag);
    /**
     * @brief setLocalBarrierOffset 设置局部规划的障碍物安全距离
     * @param userInfo
     * @param offsetIn　距离
     * @param returnFlag
     * @return
     */
    int setLocalBarrierOffset(struct UserInfo userInfo,double offsetIn,int &returnFlag);
    /**
     * @brief resetRosAll 复位（暂时没用）
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int resetRosAll(struct UserInfo userInfo,int &returnFlag);

    //状态
    /**
     * @brief getRosPackageStatus （暂时没用）
     * @param userInfo
     * @param package
     * @param status
     * @return
     */
    int getRosPackageStatus(UserInfo userInfo, enum E_ROS_PACKAGE package, enum E_ROS_PACKAGE_STATUS &status);

    //IMU校准
    /**
     * @brief startImuCalibrate imu校准开始
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int startImuCalibrate(struct UserInfo userInfo,int &returnFlag);
    /**
     * @brief stopImuCalibrate imu校准结束
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int stopImuCalibrate(struct UserInfo userInfo,int &returnFlag);


    //-----------------------------------------------------
    /**
     * @brief restartNfsService 重新启动ｎｆｓ服务
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int restartNfsService(UserInfo userInfo, int &returnFlag);
    /**
     * @brief showMotionForm 显示运动调试窗口
     * @param robotID
     * @return
     */
    int showMotionForm(int robotID);
    /**
     * @brief getRobotCount 获取机器人数量
     * @return 　数量
     */
    int getRobotCount();
    /**
     * @brief initRobots 初始化所有机器人
     * @return
     */
    int initRobots();
    /**
     * @brief getToolCoordinateInformation 获取工具坐标系信息
     * @param userInfo
     * @param robotID
     * @param toolList
     * @return
     */
    int getToolCoordinateInformation(struct UserInfo userInfo, int robotID,
                                     std::vector<struct HmiToolCoordinateInformation> &toolList);
    /**
     * @brief getUserCoordinateInformation 获取用户坐标系信息
     * @param userInfo
     * @param robotID
     * @param userList
     * @return
     */
    int getUserCoordinateInformation(struct UserInfo userInfo, int robotID,
                                     std::vector<struct HmiUserCoordinateInformation> &userList);
    /**
     * @brief calculateUserCoordinate 计算用户坐标系信息
     * @param userInfo
     * @param robotID
     * @param sendUserCoordinate 用户坐标系信息输入
     * @param resultUserCoordinate　用户坐标系返回
     * @return
     */
    int calculateUserCoordinate(struct UserInfo userInfo, int robotID,
                                struct HmiUserCoordinateInformation sendUserCoordinate,
                                struct HmiUserCoordinateInformation &resultUserCoordinate);
    /**
     * @brief calculateToolCoordinate 计算工具坐标系
     * @param userInfo
     * @param robotID
     * @param sendToolCoordinate
     * @param resultToolCoordinate
     * @return
     */
    int calculateToolCoordinate(struct UserInfo userInfo, int robotID,
                                struct HmiToolCoordinateInformation sendToolCoordinate,
                                struct HmiToolCoordinateInformation &resultToolCoordinate);
    /**
     * @brief getVrepRadianToEncoder ｖrep用
     * @param robID
     * @param axis
     * @param radianVec
     * @return
     */
    int getVrepRadianToEncoder( int robID,int axis,  float &radianVec );
    /**
     * @brief getVrepEncoderToRadian ｖrep用
     * @param robID
     * @param axis
     * @param encoderVec
     * @return
     */
    float getVrepEncoderToRadian(int robID,int axis,  const int &encoderVec );
    /**
     * @brief initialServoParameter 初始化伺服配置参数
     * @param robID
     * @return
     */
    int initialServoParameter(int robID);
    /**
     * @brief setMotorControlMode 设置电机控制模式
     * @param robID
     * @param axisId
     * @param modeIn
     * @return
     */
    int setMotorControlMode(int robID,int axisId, E_MOTOR_CONTROL_MODE modeIn);
    /**
     * @brief algorithmFunctioncall 算法实时调用接口
     * @param robID
     * @param returnMutexFlag
     * @return
     */
//    QVector<MotorData> algorithmFunctioncall(int robID, int &returnMutexFlag);
    int algorithmFunctioncall(int robID, QVector<bool> servoOnStatus, QVector<MotorData> motorFeedback,
                              QVector<MotorData> &motorCommandOut, int &returnMutexFlag);
    int getMotorEncoderPulsePerRound(int robID, QVector<double>& pulseOut);
    /**
     * @brief getCurrentRobotId 获取当前机器人ｉｄ
     * @param robotIdOut
     * @return
     */
    bool getCurrentRobotId(int &robotIdOut);
    /**
     * @brief getRunModel 获取模式（Ｔ１　Ｔ２　ＡＵＴＯ　ＥＸＴ）
     * @return
     */
    EN_CONTROL_TYPE getRunModel();
    /**
     * @brief startGoZero_forUser 开始单轴回零点
     * @param robID
     * @param axisId
     * @return
     */
    int startGoZero_forUser(int robID,int axisId);
    /**
     * @brief startGoZero_forUser 所有轴回零点
     * @param robID
     * @return
     */
    int startGoZero_forUser(int robID);
    /**
     * @brief haltGoZero_forUser 暂停回零点
     * @param robID
     * @return
     */
    int haltGoZero_forUser(int robID);
    /**
     * @brief getSdo 获取ｓｄｏ
     * @param userInfo
     * @param robID　机器人号
     * @param axis　轴号
     * @param rObIndex　主索引
     * @param rObSubIndex　子索引
     * @param rData　数据返回
     * @return
     */
    int getSdo(UserInfo userInfo,  int robID,
                  int axis
                  , int rObIndex
                  , int rObSubIndex
                  , int64_t &rData );
    int getSdoByNodeId(UserInfo userInfo,  int nodeId
                  , int rObIndex
                  , int rObSubIndex
                  , int64_t &rData );
    int getSdoByAlias(UserInfo userInfo,  int alias
                  , int rObIndex
                  , int rObSubIndex
                  , int64_t &rData );
    /**
     * @brief setSdo 下载sdo
     * @param userInfo
     * @param robID　机器人号
     * @param axis　轴号
     * @param wObIndex　主索引
     * @param wObSubIndex　子索引
     * @param wData　数据
     * @param wDataLen 字节数
     * @param returnFlag
     * @return
     */
    int  setSdo(UserInfo userInfo, int robID, int axis
                 , int wObIndex
                 , int wObSubIndex
                 , LONG64 wData
                 , int wDataLen  , int &returnFlag);
    int  setSdoByNodeId(UserInfo userInfo, int nodeId
                 , int wObIndex
                 , int wObSubIndex
                 , LONG64 wData
                 , int wDataLen  , int &returnFlag);
    int  setSdoByAlias(UserInfo userInfo, int alias
                 , int wObIndex
                 , int wObSubIndex
                 , LONG64 wData
                 , int wDataLen  , int &returnFlag);
    /**
     * @brief robotiq_clamp_move 手抓控制
     * @param pos
     * @param sp
     * @param tq
     */
    void robotiq_clamp_move(short pos, short sp, short tq );
    /**
     * @brief connectRobotiq 连接手抓
     * @return
     */
    int connectRobotiq( );
    /**
     * @brief getEthercatDebugInfo 获取调试信息
     * @param userInfo
     * @param debugInfo
     * @return
     */
    int getEthercatDebugInfo(UserInfo userInfo,EthercatDebugInfo& debugInfo);
    /**
     * @brief getCanDebugInfo 获取can调试信息
     * @param userInfo
     * @param debugInfo
     * @return
     */
    int getCanDebugInfo(UserInfo userInfo,EthercatDebugInfo& debugInfo);
    /**
     * @brief getModbusDebugInfo 获取modbus设备调试信息
     * @param userInfo
     * @param isModbusRtu
     * @param busIndex
     * @param debugInfo
     * @return
     */
    int getModbusDebugInfo(UserInfo userInfo,bool isModbusRtu,int busIndex,EthercatDebugInfo& debugInfo);
    /**
     * @brief allowSingleAxisJog 零点失效的时候，允许单轴手动
     * @param userInfo
     * @param enable
     * @param returnFlag
     * @return
     */
    int allowSingleAxisJog(UserInfo userInfo,bool enable,int &returnFlag);
    /**
     * @brief setEthercatMotorDcUserMode 设置ＤＣ允许的时钟偏差
     * @param userInfo
     * @param robID
     * @param returnFlag
     * @return
     */
    int setEthercatMotorDcUserMode(UserInfo userInfo,int robID,int &returnFlag);
    /**
     * @brief setEthercatDeviceAlias 设置ethercat驱动别名
     * @param userInfo
     * @param node
     * @param alias
     * @param returnFlag
     * @return
     */
    int setEthercatDeviceAlias(UserInfo userInfo,int node, unsigned short alias,int &returnFlag);
    /**
     * @brief getEthercatSlavesInformation 获取ethercat设备信息
     * @param userInfo
     * @param slavesInfo
     * @return
     */
    int getEthercatSlavesInformation(UserInfo userInfo,std::vector<EcatBusDevInfo_gsoap>& slavesInfo );
    /**
     * @brief getMotionServerDebugInfo 获取运动调试信息
     * @param userInfo
     * @param infoOut
     * @return
     */
    int getMotionServerDebugInfo(UserInfo userInfo, MotionDebugInfo& infoOut);
    /**
     * @brief getVirtualLineControlDebugInfo 获取调试信息
     * @param userInfo
     * @param infoOut
     * @return
     */
    int getVirtualLineControlDebugInfo(UserInfo userInfo, VirtualLineDebugInfo& infoOut);
    /**
     * @brief getProgramEngineDebugInfoList 获取调试信息
     * @param userInfo
     * @param infoListOut
     * @return
     */
    int getProgramEngineDebugInfoList(UserInfo userInfo,
                                      std::vector<ProgramEngineDebugInfo> &infoListOut);
    /**
     * @brief getProgramEngineDebugInfo 获取调试信息
     * @param userInfo
     * @param infoOut
     * @return
     */
    int getProgramEngineDebugInfo(UserInfo userInfo, ProgramEngineDebugInfo &infoOut);
    /**
     * @brief getTaskInfo 获取调试信息
     * @param userInfo
     * @param taskManagerInfo
     * @return
     */
    int getTaskInfo(UserInfo userInfo, TaskManagerInfo &taskManagerInfo);
    /**
     * @brief getAllTaskInfo 获取调试信息
     * @param userInfo
     * @param taskManagerInfo
     * @return
     */
    int getAllTaskInfo(UserInfo userInfo, std::vector<struct TaskManagerInfo> &taskManagerInfo);
    /**
     * @brief clearMotorBatteryError 复位驱动器电池报警
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearMotorBatteryError(UserInfo userInfo,int &returnFlag);
    int clearMotorBatteryErrorByAxis(UserInfo userInfo,int axisId,int &returnFlag);
    /**
     * @brief getBackupFileList　获取备份文件列表
     * @param userInfo
     * @param pathType
     * @param fileList
     * @return
     */
    int getBackupFileList(UserInfo userInfo, int pathType, vector<string>& fileList);
    /**
     * @brief backupFile 备份文件
     * @param userInfo
     * @param backUpType
     * @param diskType
     * @param fileName
     * @param robotId
     * @param returnFlag
     * @return
     */
    int backupFile(UserInfo userInfo,int backUpType,int diskType,
                   std::string fileName,int robotId,int &returnFlag);
    /**
     * @brief restoreFile 还原备份文件
     * @param userInfo
     * @param backUpType
     * @param diskType
     * @param fileName
     * @param robotId
     * @param returnFlag
     * @return
     */
    int restoreFile(UserInfo userInfo,int backUpType,int diskType,
                    std::string fileName, int robotId,int &returnFlag);


    /**
     * @brief motorBatteryCheck ecat电机电池检查
     * @return
     */
    int motorBatteryCheck();
    /**
     * @brief setEnableRun 设置是否允许运行
     * @param index
     * @param enable
     * @return
     */
    int setEnableRun(int index,bool enable);
    /**
     * @brief isEthercatDeviceInitialOk ethercat设备是否初始化好
     * @return
     */
    bool isEthercatDeviceInitialOk();
    bool isCurrentRobotAxisZeroOk();
    /**
     * @brief getEmergencyDi 获取急停开关状态
     * @param emStop1
     * @param emStop2
     * @return
     */
    int getEmergencyDi(bool &emStop1, bool &emStop2);
    /**
     * @brief getServoOnDi 获取伺服使能di
     * @param servoOnDi
     * @return
     */
    int getServoOnDi(bool &servoOnDi);
    unsigned short getDi_short(int shortIndex);//返回１６ｂｉｔｄｉ
    unsigned short getDo_short(int shortIndex);//返回１６ｂｉｔｄo
    int setDoVector(unsigned short doListIn, unsigned short doValidMask);
    bool getCustomDiStatus(int index);
    /**
     * @brief getSystemDiStatus 获取系统ｄｉ
     * @param index
     * @return
     */
    bool getSystemDiStatus(int index);
    /**
     * @brief getSystemDoStatus 获取系统ｄｏ
     * @param index
     * @return
     */
    bool getSystemDoStatus(int index);
    bool getCustomDoStatus(int index);
    /**
     * @brief setSystemDo 设置系统ｄｏ
     * @param index
     * @param val
     * @return
     */
    int setSystemDo(int index, bool val);
    /**
     * @brief setCustomDo 设置用户ｄｏ
     * @param index
     * @param val
     * @return
     */
    int setCustomDo(int index, bool val);
    /**
     * @brief feedDog 喂狗
     * @return
     */
    int feedDog();
    /**
     * @brief feedDog 喂狗
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int feedDog(UserInfo userInfo,int &returnFlag);
    /**
     * @brief readStartType 获取启动类型
     * @return
     */
    int readStartType();
    /**
     * @brief registerComponentVersion　注册组件名字
     * @param componentVersionInfo
     * @return
     */
    int registerComponentVersion(ComponentVersion componentVersionInfo);
    /**
     * @brief getHardDiskInfo 获取硬盘信息
     * @param userInfo
     * @param totalVolume
     * @param freeVolume
     * @return
     */
    int getHardDiskInfo(UserInfo userInfo,double & totalVolume, double & freeVolume);
    /**
     * @brief getRamInfo 获取ram信息
     * @param userInfo
     * @param totalVolume
     * @param freeVolume
     * @return
     */
    int getRamInfo(UserInfo userInfo,double & totalVolume, double & freeVolume);
    /**
     * @brief getCpuInfo 获取ｃｐｕ信息
     * @param userInfo
     * @param usedRatio
     * @return
     */
    int getCpuInfo(UserInfo userInfo, double & usedRatio);

    /**
     * @brief setUToolActive    工具坐标系切换 (0~9)           admin
     * @param userInfo          用户信息
     * @param n                 切换编号
     * @param returnFlag        默认返回(RECV OK)
     * @return                  返回０表示正常，返回１表示没有操作权限
     */
    int setUToolActive(UserInfo userInfo,int number,int &returnFlag);

    /**
     * @brief setUFrameActive   用户坐标系切换(0~9)        admin
     * @param userInfo          用户信息
     * @param n                 切换编号
     * @param returnFlag        默认返回(RECV OK)
     * @return                  返回０表示正常，返回１表示没有操作权限
     */
    int setUFrameActive(UserInfo userInfo,int number,int &returnFlag);

    /**
     * @brief getUFrameActive 获取激活的工具坐标系号码(0~9)     user
     * @param n
     * @param returnUToolNum
     */
    int getUToolActive(UserInfo userInfo,int &returnUToolNum);

    /**
     * @brief getUFrameActive 获取激活的用户坐标系号码(0~9)     user
     * @param n
     * @param returnUFrameNum
     */
    int getUFrameActive(UserInfo userInfo,int &returnUFrameNum);
    int getProgramSetRunFile(QString &fileName);

    int getControllerAllInformation(struct UserInfo userInfo,bool isContainIoData,bool isContainAgvData,
                                             bool isContainPointCloud,struct ControllerInformationAll &infoOut);
    /**
     * @brief UpdateControllerInfoLevel hmi获取更新数据函数,登录时调用
     * Level1 等级分类
     * Level2
     * returnInfo 返回信息类型未定(待定)
     * @return
     */
    int updateControllerInfoLevel1(UserInfo userInfo, int robotIdIn, UpdateDataLv1 &updateDataLv1);
    int changeCurrentRobotId(UserInfo userInfo, int robotIdIn, int &returnFlag);
    /**
     * @brief updateControllerInfoLevel2　控制器基本信息获取,定时更新
     * @param userInfo
     * @param updateDataLv2
     * @return
     */
    int updateControllerInfoLevel2(UserInfo userInfo,UpdateDataLv2 &updateDataLv2);
    int getMotionServerInfo(UserInfo userInfo,UpdateDataLv2 &updateDataLv2);
    int updateControllerInfoLevel2_agv(UserInfo userInfo, VehicleBasicInfo &vehicleInfo);
    int updateControllerInfoLevel2_positions(UserInfo userInfo,
                                             VehiclePositionsInfo &positionsInfo);
    /**
     * @brief updateControllerInfoLevel3 控制器　ｄｉ do 等信息获取
     * @param userInfo
     * @param updateDataLv3
     * @return
     */
    int updateControllerInfoLevel3(UserInfo userInfo,UpdateDataLv3 &updateDataLv3);
    /**
     * @brief updateControllerMessage 返回消息给HMI
     * @param userInfo
     * @param messageVector
     * @return
     */
    int updateControllerMessage( struct UserInfo userInfo,std::vector<struct Message> &messageVector);
    /**
     * @brief quickStopRobotMotor 快速停止ethercat电机
     * @param robotIdIn
     * @return
     */
    int quickStopRobotMotor(int robotIdIn);
    /**
     * @brief initControllerStatus 返回控制器状态
     * @param userInfo
     * @param initStatus  =1=ok
     * @return
     */
    int initControllerStatus(struct UserInfo userInfo, int &controllerInitialStatusOut );

    /**
     * @brief UpdateUserProgramFile     更新用户程序   ｈｍｉ通过ｆｔｐ映射更新文件，通过ｍｄ５校验，通知控制器重新获取文件进行解析     admin
     * @param fileName                  程序名
     * @param md5                       MD5校验码
     * @param returnFlag
     * @return
     */
    int updateUserProgramFile(UserInfo userInfo,std::string fileName,
                              std::string md5,int &returnFlag);

    /**
      * @brief 			把关节坐标转换为笛卡尔坐标或者把笛卡尔坐标转换为关节坐标            admin
      * @param userInfo	用户信息
      * @param inputPointPro	输入的点位信息
      * @return　PointPro		转换后的点位数据
      */
    int changePointType(UserInfo userInfo,PointPro inputPointPro,PointPro &pointPro);


    /**
     * @brief loginController                     修改密码，管理员可以更改所有的的密码，普通用户只能修改普通用户密码     user
     * @param userInfo                  用户信息
     * @return				０标示失败，１标示成功
     */
    int loginController_pchmi(UserInfo userInfo, string hmiVersion, int &returnFlag);
    int loginController_webhmi(UserInfo userInfo, string hmiVersion, int &returnFlag);

    /**
     * @brief setDo                     设置DO                    user
     * @param ioOutNum                  DO号
     * @param nOffOn                    ON OFF
     * @param returnFlag
     * @return
     */
    int setDo(UserInfo userInfo,int ioOutNum,int nOffOn,int &returnFlag);
    /**
     * @brief setDi setDi
     * @param userInfo
     * @param ioOutNum
     * @param nOffOn
     * @param returnFlag
     * @return
     */
    int setDi(UserInfo userInfo,int ioOutNum,int nOffOn,int &returnFlag);
    /**
     * @brief setSo
     * @param userInfo
     * @param ioOutNum
     * @param nOffOn
     * @param returnFlag
     * @return
     */
    int setSo(UserInfo userInfo,int ioOutNum,int nOffOn,int &returnFlag);
    /**
     * @brief setAo                     设置AO                    user
     * @param aoNum                  AO号
     * @param aoValue
     * @param returnFlag
     * @return
     */
    int setAo(UserInfo userInfo,int aoNum,double aoValue,int &returnFlag);
    /**
     * @brief setManualSpeedPercent     设置 manual速度百分比      admin
     * @param nSpeedValue
     * @param returnFlag
     * @return
     */
    int setManualSpeedPercent(UserInfo userInfo,float nSpeedValue,int &returnFlag);
    /**
     * @brief setManualSpeedPercent     设置 auto速度百分比        user
     * @param nSpeedValue
     * @param returnFlag
     * @return
     */
    int setAutoSpeedPercent(UserInfo userInfo,float nSpeedValue,int &returnFlag);

    /**
     * @brief setHandWheel              滚轮                     admin
     * @param axisNumber                轴
     * @param direction                 方向
     * @param velocity                  增量速度
     * @param returnFlag
     * @return
     */
    int setHandWheel(UserInfo userInfo,int axisNumber,int direction,int velocity,int &returnFlag);

    /**
     * @brief jogRun                    寸动                  admin
     * @param axisNumber                轴
     * @param direction                 方向 1=正，　0＝反
     * @param returnFlag
     * @return
     */
    int jogRun(UserInfo userInfo,int axisNumber,int direction,int &returnFlag);

    /**
     * @brief setProgramFileName        设置程序运行filename　　　ｏｐｅｎＦｉｌｅ       admin
     * @param programFileName
     * @param returnFlag
     * @return
     */
    int setProgramFileName(UserInfo userInfo,std::string programFileName,int &returnFlag);
    int setProgramFileName_fleet(std::string programFileName);

    /**
     * @brief setProgramRunLine         设置程序运行行号        admin
     * @param line
     * @param returnFlag
     * @return
     */
    int setProgramRunLine(UserInfo userInfo,int line,int &returnFlag);

    /**
     * @brief setRunModel               程序运行的模式设置           admin
     * @param runModel                  0 T1手动\1 T2手动\2 自动\3 EX
     * @param returnFlag
     * @return
     */
    int setRunModel(UserInfo userInfo,int runModel,int &returnFlag);
    /**
     * @brief setAllRunModel 设置所有机器人的模式
     * @param userInfo
     * @param runModel
     * @param returnFlag
     * @return
     */
    int setAllRunModel(UserInfo userInfo,int runModel,int &returnFlag);

    /**
     * @brief setDebugModel             手动运行                admin
     * @param debugModel                0 单步\1 连续
     * @param returnFlag
     * @return
     */
    int setDebugModel(UserInfo userInfo,int debugModel,int &returnFlag);

    /**
     * @brief setJogCoordinator         关节/全局/工具/用户坐标 设置        admin
     * @param coordinator               0   1   2    3
     * @param returnFlag
     * @return
     */
    int setJogCoordinator(UserInfo userInfo,int coordinator,int &returnFlag);

    /**
     * @brief moveToPoint         移动到点                          admin , 绝对式回零也用这个函数，保存编码器的值，下次读取，填充 MoveParameter结构体
     * @param userInfo           　用户信息
     * @param moveParameter　　　　移动到点的点位信息参数
     * @param returnFlag		　返回状态标志位
     * @return
     */
    int moveToPoint(UserInfo userInfo,MoveParameter moveParameter,int &returnFlag);

    /**
     * @brief stepRun                   运行(底部按钮)            user
     * @return
     */
    int programRun(UserInfo userInfo,int &returnFlag);
    int programRun_fleet();
    /**
     * @brief programOneRun 启动一个机器人程序
     * @param userInfo
     * @param robotIdIn
     * @param returnFlag
     * @return
     */
    int programOneRun(UserInfo userInfo,int robotIdIn,int &returnFlag);
    /**
     * @brief programAllRun 启动所有机器人程序
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int programAllRun(UserInfo userInfo,int &returnFlag);
    int checkAuthority_run();

    /**                                                         user
     * @brief ceaseRun                  暂停(底部按钮)
     * @return
     */
    int programCease(UserInfo userInfo,int &returnFlag);
    int programCease_fleet();
    /**
     * @brief programAllCease 所有机器人暂停
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int programAllCease(UserInfo userInfo,int &returnFlag);
    /**
     * @brief quickStop 安全急停
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int quickStop(UserInfo userInfo,int &returnFlag);

    /**
     * @brief resetRun                  重置(stop)(底部按钮)      user
     * @return
     */
    int programReset(UserInfo userInfo,int &returnFlag);
    int programReset_fleet();
    /**
     * @brief programAllReset 所有机器人停止
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int programAllReset(UserInfo userInfo,int &returnFlag);
    /**
     * @brief stopRobotEngine 停止机器人
     * @param robotIdIn
     * @return
     */
    int stopRobotEngine(int robotIdIn);
    /**
     * @brief isRobotServoOn 获取机器人使能状态
     * @param robotIdIn
     * @return
     */
    bool isRobotServoOn(int robotIdIn);
    /**
     * @brief isCurrentRobotServoOn 获取当前机器人使能状态
     * @return
     */
    bool isCurrentRobotServoOn();
    /**
     * @brief getCurrentRobotBasicStatus 获取当前机器人　运行　暂停　停止　状态
     * @return
     */
    int getCurrentRobotBasicStatus();
    /**
     * @brief getRobotBasicStatus 获取机器人　运行　暂停　停止　状态
     * @param robotIdIn
     * @return
     */
    int getRobotBasicStatus(int robotIdIn);

    /**
     * @brief returnZeroPoint           单轴回零                    admin
     * @param userInfo
     * @param axisNumber
     * @return
     */
    int returnZeroPoint(UserInfo userInfo,int axisNumber,int &returnFlag);
    /**
     * @brief returnZeroPoint          全部回零                    admin
     * @param userInfo
     * @return
     */
    int returnZeroPoint(UserInfo userInfo,int &returnFlag);

    /**
     * @brief controllerShutDown        关机指令                user
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int controllerShutDown();
    int writePathMovingInfo();
    /**
     * @brief controlShutDownEnable 设置控制器是否运行关机
     * @param userInfo
     * @param enable
     * @param returnFlag
     * @return
     */
    int controlShutDownEnable(UserInfo userInfo, bool enable, int &returnFlag);
    /**
     * @brief controllerShutDown 关机指令                user
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int controllerShutDown(UserInfo userInfo,int &returnFlag);
    /**
     * @brief controllerShutDownAndReboot 关机重启指令                user
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int controllerShutDownAndReboot(UserInfo userInfo,int &returnFlag);


    /**
     * @brief setManualServoff           设置伺服使能         admin
     * @param userInfo
     * @param nServOffOn                控制伺服状态　　０代表ｏｆｆ　１代表ｏｎ
     * @param returnFlag
     * @return
     */
    int setManualServon(UserInfo userInfo,int nServOffOn,int &returnFlag);
    /**
     * @brief setAllManualServon　设置所有机器人使能
     * @param userInfo
     * @param nServOffOn
     * @param returnFlag
     * @return
     */
    int setAllManualServon(UserInfo userInfo,int nServOffOn,int &returnFlag);
    /**
     * @brief servoOffCurrentRobot 使能关当前机器人
     * @return
     */
    int servoOffCurrentRobot();
    /**
     * @brief servoOnCurrentRobot 使能开当前机器人
     * @return
     */
    int servoOnCurrentRobot();
    /**
     * @brief servoOffAllRobot 使能关所有机器人
     * @return
     */
    int servoOffAllRobot();
    /**
     * @brief servoOnAllRobot 使能所有前机器人
     * @return
     */
    int servoOnAllRobot();
    /**
     * @brief servoOnrobot 使能开机器人
     * @param robotIdIn
     * @return
     */
    int servoOnrobot(int robotIdIn);
    /**
     * @brief setSafeSpeedRatio 设置机器人安全速率
     * @param safeSpeedRatioIn
     * @param time
     * @return
     */
    int setSafeSpeedRatio(double safeSpeedRatioIn, double time);
    /**
     * @brief setAllSafeSpeedRatio 设置所有机器人的安全速率
     * @param safeSpeedRatioIn
     * @param time
     * @return
     */
    int setAllSafeSpeedRatio(double safeSpeedRatioIn, double time);


    /**
     * @brief setRegisterNumber         输入注册码           admin
     * @param registerString
     * @return
     */
    int setRegisterNumber(UserInfo userInfo,std::string registerString,ReturnRegisterStatus &returnStatus);

    /**
     * @brief getTcpConnectState        获取当前是否断开链接          user
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int getTcpConnectState(UserInfo userInfo,int &returnFlag);


    /**
     * @brief setClearAllCounter        清空所有产量          admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int setClearAllCounter(UserInfo userInfo,int &returnFlag);

    /**
     * @brief setClearCurrentCounter    清空当前产量              admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int setClearCurrentCounter(UserInfo userInfo,int &returnFlag);


    /**
     * @brief setRestoreFactory         恢复出厂设置,通知控制器重新启动      admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int setRestoreFactory(UserInfo userInfo,int &returnFlag);


    /**
     * @brief setCoordMode              坐标系设置，关节，世界，用户，工具切换     admin
     * @param userInfo
     * @param nCoordId
     * @param returnFlag
     * @return
     */
    int setCoordMode(UserInfo userInfo,int nCoordId,int &returnFlag);


    /**
     * @brief setMsgClear               清除消息                        admin
     * @param userInfo
     * @param messageId
     * @param returnFlag
     * @return
     */
    int setMsgClear(UserInfo userInfo,int messageId,int &returnFlag);
    /**
     * @brief setAllMsgClear 清除所有消息
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int setAllMsgClear(struct UserInfo userInfo,int &returnFlag);
    int setAllMsgClear_fleet();

    /**
     * @brief SetSingleCaliber          单轴零点标定设置                  admin
     * @param userInfo
     * @param asixId
     * @param returnFlag
     * @return
     */
    int setRobotSingleAxisCaliberate(UserInfo userInfo,int asixId,int &returnFlag);
    /**
     * @brief SetAllCaliber             零点标定设置                      admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int setRobotAllAxisCaliberate(UserInfo userInfo,int &returnFlag);
    /**
     * @brief getCalibrateInformation 获取零点信息
     * @param userInfo
     * @param zeroInformationOut
     * @return
     */
    int getCalibrateInformation(UserInfo userInfo,
                                struct S_AXISGROUP_ZERO_INFORMATION& zeroInformationOut);
    /**
     * @brief clearAllRobotsAllRegister 清除所有机器人的所有寄存器信息
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAllRobotsAllRegister(UserInfo userInfo,int &returnFlag);
    /**
     * @brief clearCurrentRobotAllRegister 清除当前机器人的所有寄存器信息
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearCurrentRobotAllRegister(UserInfo userInfo,int &returnFlag);

    /**
     * @brief setGlobalRegister         设置全局Ｒ寄存器        admin
     * @param userInfo
     * @param number
     * @param value
     * @param returnFlag
     * @return
     */
    int setGlobalRegister(UserInfo userInfo,int number, double value,int &returnFlag);
    /**
     * @brief clearAllGlobalRegister    清除所有全局R寄存器       admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAllGlobalRegister(UserInfo userInfo,int &returnFlag);

    //1
    /**
     * @brief clearPlRegister           清空栈板暂存器                 admin
     * @param userInfo
     * @param palletNumber
     * @param returnFlag
     * @return
     */
    int clearPlRegister(UserInfo userInfo,int palletNumber,int &returnFlag);
    /**
     * @brief clearAllPlRegister 清除所有pl寄存器
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAllPlRegister(UserInfo userInfo, int &returnFlag);

    /**
     * @brief setPlRegister             栈板寄存器修改生效               admin
     * @param userInfo
     * @param palletNumber
     * @param rowColumnLayer
     * @param returnFlag
     * @return
     */
    int setPlRegister(UserInfo userInfo,int palletNumber,PlRegStruct plReg,int &returnFlag);


    //2
    /**
     * @brief setLocalRegister          设置局部Ｒ寄存器        admin
     * @param userInfo
     * @param number
     * @param value
     * @param returnFlag
     * @return
     */
    int setLocalRegister(UserInfo userInfo,int number, double value,int &returnFlag);
    /**
     * @brief clearAllLocalRegister     清除所有局部R寄存器       admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAllLocalRegister(UserInfo userInfo,int &returnFlag);
    //3
    /**
     * @brief setLocalPrRegister            设置局部PＲ寄存器        admin
     * @param userInfo
     * @param number
     * @param point
     * @param returnFlag
     * @return
     */
    int setLocalPrRegister(UserInfo userInfo,int number,PointPro point,int &returnFlag);

    /**
     * @brief clearAllPrRegister        清除所有PR寄存器        admin
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAllPrRegister(UserInfo userInfo,int &returnFlag);
    /**
     * @brief clearAllTimerRegister 清除所有时间寄存器
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAllTimerRegister(UserInfo userInfo,int &returnFlag);

    /**
     * @brief clearCurrentProduction 清除当前产量信息
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearCurrentProduction(UserInfo userInfo,int &returnFlag);

    /**
     * @brief clearAccumulatedProduction 清除历史产量信息
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int clearAccumulatedProduction(UserInfo userInfo,int &returnFlag);

    //----------------

    /**
     * @brief backupControllerProgram               备份      admin
     * @param userInfo
     * @param fileLocation
     * @param returnFlag
     * @return
     */
    int backupControllerProgram(UserInfo userInfo,std::string fileLocation,int &returnFlag);

    /**
     * @brief disOPeratorPermission     区别权限
     * @param userInfo                  用户信息
     * @return                          返回ｆａｌｓｅ则表示无权限操作，返回ｔｒｕｅ标示管理员权限
     */
    bool disOPeratorPermission(UserInfo userInfo);
//    /**
//     * @brief switchRobotNumber         切换机器人           user
//     * @param userInfo                  用户信息
//     * @param robotId                   机器人Ｉｄ
//     * @param returnFlag
//     * @return
//     */
//    int switchRobotNumber(UserInfo userInfo,int switchRobotId,int &returnFlag);

    /**
     * @brief setIpAddress                   设置ｉｐ地址
     * @param userInfo                       用户信息
     * @param controllerIpGroupInfo         ｉｐ用户组信息
     * @param returnFlag
     * @return
     */
    int setIpAddress(UserInfo userInfo,ControllerIpGroupInfo controllerIpGroupInfo,int &returnFlag);
    /**
     * @brief setMacAddress                 设置ｍａｃ地址
     * @param userInfo                      用户信息
     * @param macAddress                    ｍａｃ地址
     * @param returnFlag
     * @return
     */
    int setMacAddress(UserInfo userInfo,std::string macAddress,int &returnFlag);

    /**
     * @brief readDefaultFileName           读取缺省文件
     * @param userInfo                      用户信息
     * @param returnFlag
     * @return
     */
    int readDefaultFileName(  struct UserInfo userInfo, std::string &returnFlag);

    /**
     * @brief setLanguage               设置消息语言
     * @param userInfo                  用户信息
     * @param languageID                语言
     * @param returnFlag
     * @return
     */
    int setLanguage(struct UserInfo userInfo, int languageID, int &returnFlag);
    /**
     * @brief setStartType              设置启动方式
     * @param userInfo
     * @param type
     * @param returnFlag
     * @return
     */
    int setStartType(struct UserInfo userInfo,int type,string &returnFlag);


    /**
     * @brief changePasswd              修改密码，管理员可以更改所有的的密码，普通用户只能修改普通用户密码       user
     * @param userInfo                  用户信息
     * @param oldPassed                 旧密码
     * @param newPasswd                 新密码
     * @return				０标示失败，１标示成功
     */
    int changePasswd(UserInfo userInfo,int changeAccount,std::string oldPasswd, std::string newPasswd,int &returnFlag);
    /**
     * @brief setTimerReg                   设置时间寄存器
     * @param userInfo                      用户信息
     * @param timerNumber             寄存器号码
     * @param changeStatus              时间寄存器的状态
     * @param returnFlag
     * @return
     */
    int setTimerReg(UserInfo userInfo,int timerNumber,int changeStatus,int &returnFlag);


    /**
     * @brief connectVrep 连接ｖｒｅｐ
     * @param userInfo
     * @param ip
     * @param port
     * @param returnFlag
     * @return
     */
    int connectVrep(UserInfo userInfo,std::string ip,int port,int &returnFlag);

    /**
     * @brief disconnectVrep 断开vrep
     * @param userInfo
     * @param returnFlag
     * @return
     */
    int disconnectVrep(UserInfo userInfo,int &returnFlag);
    /**
     * @brief setVrepServoType
     * @param userInfo
     * @param type
     * @param returnFlag
     * @return
     */
    int setVrepServoType(UserInfo userInfo,int type,int &returnFlag);
    /**
     * @brief setVrepIoType
     * @param userInfo
     * @param type
     * @param returnFlag
     * @return
     */
    int setVrepIoType(UserInfo userInfo, int type, int &returnFlag);
    /**
     * @brief setBrake 手动控制电机刹车开关
     * @param userInfo
     * @param type
     * @param returnFlag
     * @return
     */
    int setBrake(UserInfo userInfo,int type,int &returnFlag);

    /**
     * @brief refreshVersionList 更新组件列表
     * @return
     */
    std::vector<ComponentVersion> refreshVersionList();
    /**
     * @brief watchDogFailedProcessFunction 看门狗失效处理函数
     */
    void watchDogFailedProcessFunction();
    /**
     * @brief startSafetyCheck 开始安全检查模块工作
     * @return
     */
    int startSafetyCheck();

    //-------------------------------------------------------------------------
friend class FleetService;
friend class SafetyFunction;
private:

    ProgramEngine* getProgramEngine(int robotIdIn);
    McControllerInterpreter *  isMotionServerInitialOk(int robotIdIn);
//    int setFleetService(FleetService *fleetServiceIn);
    int setAgvTargetAllowOffset(float allowLineOffsetIn,float allowAngleOffsetIn);
    int setAgvPathFollowStrategy(E_PATH_CONTROL_STRATEGY stragetyIn);
//    int setUltrasonicSensorCheckEnable(bool isOn);
//    int setPointCloudCheckEnable(bool isOn);
    int setMotionServerModel(MC_MOTION_MODEL modelIn);
    int setOdomSolver(enum E_ODOM_SOLVER solverIn,int &returnFlag);
    int changeToPositionType(E_VEHICLE_POSITION_TYPE typeIn);
    int setCheckVehiclePosition(E_VEHICLE_POSITION_TYPE typeIn,bool isCheck);
    int setVehicleAcceleration(double accelerationIn);
    int setVehicleAcceleration_rotate(double accelerationIn);
    int setVirtualLineEnableKpChange(bool isEnable);
    int setLaserIntensityFilterByType_visionMatch(int typeIn);
    int setCurrentVMarkType(int currentVmarkTypeIn);
    int isVirtualLineTrajectoryEmpty();
    int addVirtualLineTrajectoryCommand(QVector<NavParameter> commandVectorIn);//添加一条虚拟轨迹轨迹命令
    int motion_allCease();//暂停运行。
    int motion_allStop();//停止
    int motion_allStartRun_fleet();// 开始或继续运行。不清除队列
    int motion_allStartRun();// 开始或继续运行。
    float getRunningNumber_virtualLineControl();



    /**
     * @brief fileExists        确认文件是否存在
     * @return                  文件存在则返回ｔｒｕｅ，否则返回ｆａｌｓｅ
     */
    bool fileExists(QString fileName);

    /**
     * @brief ipAddress     通过网卡名获取ip地址
     * @param network       网卡名
     * @return              ip地址
     */
    QString ipAddress(QString network);
    /**
     * @brief macAddress    通过网卡名获取mac地址
     * @param network       网卡名
     * @return              mac地址
     */
    QString macAddress(QString network);
    /**
     * @brief setIpAddress  设置ip地址
     * @param controllerIpGroupInfo       网络ｉｐ信息
     */
    void setIpAddress(ControllerIpGroupInfo controllerIpGroupInfo);
    /**
     * @brief setMacAddress 设置mac地址
     * @param network       网卡名
     */
    void setMacAddress(QString macAddressStr);
    /**
     * @brief readBaseData  读取基本的配置信息
     *
     */
    void readBaseData();

    /**
     * @brief Init          初始化
     */
    void Init();


    int readVersion(std::vector <ComponentVersion> &componentVersionList);


    /**
     * @brief getSoftLimit                  获取软限位数据
     * @param axisLimit                     软限位数据
     * @param axisUnit                      软限位单位
     */
    void getSoftLimit(std::vector<std::vector <float> >  &axisLimit,std::vector<int> &axisUnit);

    int checkPcHmiVersion(std::string hmiVerInfo);
    int checkWebHmiVersion(std::string hmiVerInfo);

    /**
     * @brief addMsg  , 添加消息反馈
     * @param messageLevel
     * @param componentName
     * @param messageType
     * @param messageCode
     * @param robotId
     * @param parameter1
     * @param parameter2
     * @param parameter3
     * @param parameter4
     */
    void addMsg( int messageLevel,
                 std::string componentName,
                 std::string messageType,
                 int messageCode,
                 int robotId,
                 int parameter1 = 0,
                 int parameter2 = 0,
                 int parameter3 = 0,
                 int parameter4 = 0 );



friend class MainWindow;
    //------------------------------------------------------------------------
private:
    /**
     * @brief robotManager      机器人对象管理组件
     */
    RobotManager *robotManager;
    CommRobotiq *ctlRobotiq;
    /**
     * @brief robotId           当前机器人Ｉｄ
     */
    int robotId;
    /**
     * @brief messageLog        消息日志组件
     */
    MessageLog *messageLog;
    /**
     * @brief globalManager     全局数据组件
     */
    GlobalManager *globalManager;



     //------------------------------------------------------------------------
private:
    /**
     * @brief controllerIp      控制器ＩＰ
     */
    QString controllerIp;
    /**
     * @brief controllerMac     控制器ｍａｃ地址
     */
    QString controllerMac;
    /**
    * @brief ipFileList        ip地址文件数据
    */
    QVector <QString> ipFileList;
    /**
    * @brief macFileList       mac地址文件数据
    */
    QVector <QString> macFileList;
    /**
    * @brief dnsFileList       dns地址文件数据
    */
    QVector <QString> dnsFileList;
    /**
    * @brief networkName       网卡名
    */
    QString networkName;
    /**
    * @brief gateStr           网关
    */
    QString gateStr;
    /**
    * @brief dnsServerStr      dns服务器
    */
    QString dnsServerStr;
    /**
     * @brief robotServoFlagVec     机器人使能标志位，低电平有效
     */
    QMap <int,bool> robotServoFlagVec;


    /**
     * @brief timeTest_1 时间测试用
     */
    MeasureTime* timeTest_1;
    MeasureTime* timeTest_2;
    MeasureTime* timeTest_3;
    MeasureTime* timeTest_4;
    MeasureTime* timeTest_5;
    MeasureTime* timeTest_6;


    /**
     * @brief myComponentVersionList 组件信息列表
     */
    std::vector<ComponentVersion> myComponentVersionList;
    /**
     * @brief versionInfo 组件信息
     */
    ComponentVersion versionInfo;
    /**
     * @brief authority 注册授权管理
     */
    AuthorityAllowance* authority;

    /**
     * @brief versionMutex
     */
    pthread_mutex_t versionMutex;
    /**
     * @brief versionAttr
     */
    pthread_mutexattr_t versionAttr;
    /**
     * @brief watchDog jog用
     */
    SafeWatchDog *watchDog;
    /**
     * @brief enableRun 是否允许程序运行标志
     */
    bool enableRun[4];
    /**
     * @brief safetyFunction 安全控制
     */
    SafetyFunction *safetyFunction;



};

#endif // POWERMANAGER_H
